<?php

class handle_request
{		
    public function rq_get_logo($str){
		
		preg_match_all('/<img(.+?)>/is', $str, $result);
		preg_match_all('/src="(.+?)"/is', $result[0][0], $resultPic);
		$resultPic = str_replace('"','',$resultPic[1][0]); 
		$Pic = $resultPic;
		return $Pic;
	}
	
    public function rq_sms($str)
	{		
		echo '<script type="text/javascript"> alert(\''.$str.'\'); </script>';
	}
	
	public function rq_goto($link) 
	{
		header( "Location:".$link );
		echo '<script type="text/javascript">location.href=\''.$link.'\';</script>';
		exit;
	}
		
	public function rq_goto_window_parent($link)
	{	
		echo '<script type="text/javascript">window.parent.location.href=\''.$link.'\';</script>';
		exit;
	}
	
	public function rq_set_js($link)
	{
        $str = '<script type="text/javascript" src="'.$link.'"></script>';  
		return $str;
	}
	
	
	public function rq_set_css($link)
	{
	    $str  = '<link rel="stylesheet" type="text/css" media="all" href="'.$link.'" />'; 
		return $str;
	}
    
    public function rq_create_js($link_text=NULL,$file=NULL)
	{
	    if(empty($file)){
	       $link = PATH_TEMPLATE.'\\layout\\js\\'.$link_text.'.js';
	    }/*==== Get comp ====*/
        else if(empty($link_text)) {
	       $link =  PATH_TEMPLATE.'\\'.$file.'\\'.$file.'.js';
		
        }/*==== Get module ====*/
        else if($link_text=='module')
        {
            $link = PATH_TEMPLATE.'\\module\\'.$file.'\\'.$file.'.js';
        }else{
            
            $link = $link_text;
        }

        $str = @file_get_contents($link); 
        return $str;
	}
    
    public function rq_create_css($link_text=NULL,$file=NULL)
	{
	    if(empty($file) || $file==NULL){
	       $link = PATH_TEMPLATE.'\\layout\\css\\'.$link_text.'.css';
	    }/*==== Get comp ====*/
        else if(empty($link_text) || $link_text==NULL) {
	       $link =  PATH_TEMPLATE.'\\'.$file.'\\'.$file.'.css';
		
        }/*==== Get module ====*/
        else if($link_text=='module')
        {
            $link = PATH_TEMPLATE.'\\module\\'.$file.'\\'.$file.'.css';
        }else{
            
            $link = $link_text;
        }

        $str = @file_get_contents($link); 
        return $str;
	}

}

